package com.preguicoso.server.dao;

import java.util.List;

import com.googlecode.objectify.ObjectifyService;
import com.googlecode.objectify.util.DAOBase;
import com.preguicoso.shared.entities.MesaBean;

public class MesaDAO extends DAOBase {
	static {
		ObjectifyService.register(MesaBean.class);
	}

	public void create(MesaBean u) {
		this.ofy().put(u);
	}

	public MesaBean retrieve(Long e,int mesa) {
		return this.ofy().query(MesaBean.class).filter("estabelecimentoId", e).filter("mesa", mesa).get();
	}

	public MesaBean retrieve(Long id) {
		return this.ofy().query(MesaBean.class).filter("id", id).get();
	}
	
	public void update(MesaBean u) {
		this.ofy().put(u);
	}

	public void delete(MesaBean u) {
		this.ofy().delete(u);
	}

	public List<MesaBean> listAll() {
		return this.ofy().query(MesaBean.class).list();
	}

}